package cn.wolfcode.qo;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.wolfcode.enums.BusinessReportEnums;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Setter
@Getter
@ToString
public class BusinessReportQueryObject extends QueryObject{
    /**
     * 默认设置分组查询的条件是门店
     */
    private String groupType = BusinessReportEnums.BUSINESS.getValue();
    /** 门店*/
    private Long businessId;
    /** 开始日期*/
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startDate;
    /** 结束日期*/
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDate;
    //预约类型
    private Boolean appointmentType;

    public Date getEndDate() {
        if (endDate != null){
            DateUtil.endOfDay(endDate);
        }
        return null;
    }
}
